<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<script src="/js/jquery-1.8.3.min.js"></script>
<body>
	<form action="/post" method="post">
		{{ csrf_field() }}
		用户名：<input type="text" name="username" value="">
		<br><br>
		<input type="submit" value="提交">
	</form>


	<button>ajax--post方式</button>
	<script>
		$('button').click(function(){
			$.ajaxSetup({
		        headers: {
		            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		        }
			});
			$.post('/post',function(msg){
				alert(msg)
			});
		})
	</script>
</body>
</html>